<?php
use app\models\ActivityApply;
use app\models\Comment;
use yii\helpers\Html;
use yii\helpers\Url;

/* @var $this \yii\web\View */
/* @var $model \app\models\Activity */

/* @var $isApply boolean */
/* @var $favoriteClass string */
/* @var $isLike boolean */

?>

<nav class="mui-bar mui-bar-tab bar-btns">
    <div class="fflex">
        <div class="col1">
            <div class="fflex">
                <a id="<?= Url::to(['user/favorite', 'aid' => $model->id]); ?>"
                   class="btn-sc favorite<?= $favoriteClass; ?>">
                    <i class="iconfont ico-sc"></i>
                    <p id="sc-txt">收藏</p>
                </a>

                <?php if($model->getIsActivity()): ?>
                <a id="<?= Url::to(['activity/like', 'id' => $model->id]); ?>"
                   class="btn-love like<?= $isLike ? ' light' : ''; ?>">
                    <i class="iconfont icon-love1"></i>
                    <p>点赞</p>
                </a>
                <?php else: ?>
                <a href="" id="shareOpenPopover">
                    <i class="iconfont">&#xe600;</i>
                    <p>分享</p>
                </a>
                <?php endif; ?>
            </div>
        </div>
        <div class="col2">
            <a title="<?= $model->getIsActivity() ? '报名' : '邀约面试'; ?>" id="<?= Url::to(['apply', 'id' => $model->id]); ?>"
               class="btn-Invitation apply<?= $isApply ? '' : ' disabled'; ?>">
                <span><?= $model->getIsActivity() ? '立即报名' : '邀约面试'; ?></span>
            </a>
        </div>
    </div>
</nav>


<div class="mui-content  career-content">

    <?= $this->render($model->getIsActivity() ? 'detail_activity' : 'detail_job', compact('model')); ?>

    <div class="infobox bgfff">
        <div class="title">
            <i class="iconfont red">&#xe64c;</i><?= $model->getIsActivity() ? '活动详情' : '职位描述'; ?>
        </div>
        <div class="bd" style="overflow:hidden;word-wrap: break-word;">
            <p><?= nl2br(Html::encode($model->content)); ?></p>
            <p><?= \app\utils\BaseUtils::arrayToImage($model->getContentImage()); ?></p>
        </div>
    </div>

    <?php if(!$model->getIsActivity()): ?>
    <div class="infobox bgfff">
        <div class="title">
            <i class="iconfont red">&#xe619;</i>公司地址
        </div>
        <div class="bd">
            <p><?= Html::encode($model->getFullAddress()); ?></p>
        </div>
    </div>
    <?php endif; ?>

    <div class="infobox bgfff">
        <div class="title">
            <i class="iconfont red">&#xe615;</i>评论区
            <button type="button" class="mui-btn mui-btn-blue mui-btn-outlined" id="commentOpenPopOver">发表评论</button>
        </div>
        <div class="bd">
            <div class="comment-list comment-list2" id="<?= Url::to(['comments', 'id' => $model->id, 'own' => $model->getIsActivity() ? Comment::OWN_ACTIVITY : Comment::OWN_JOB]); ?>">

            </div>
        </div>
    </div>

</div>

<?= $this->render('/comment/save', [
        'own' => $model->getIsActivity() ? Comment::OWN_ACTIVITY : Comment::OWN_JOB,
        'own_id' => $model->id,
        'ref' => Url::to('')
    ]
); ?>

<?= $this->registerJs("App.commentList();"); ?>
